home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
embedded
/
develop
/
libsrc11.arc
/
RDBYTSPI.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-04-27
|
846b
|
36 lines
/* rdbytspi.c 4.4 */
/*F****************************************************************************
FUNCTION NAME: rdbytspi
ACTION: Reads a character from the SPI serial hardware. Returns
an integer. The upper byte of the integer returned is the
SPI status register. The lower byte is the SPI data register.
PARAMETERS: (None)
RETURNS: (int)
******************************************************************************/
#include <hc11/io.h>
#include <hc11/spi.h>
#include <hc11/directives.h>
SMALL
unsigned rdbytspi()
{
HC11.SPCR |= SPE;
if (HC11.SPCR & MSTR)
HC11.SPSRDAT.DATAREG = HC11.SPSRDAT.DATAREG ; /* for loopback */
while ((HC11.SPSRDAT.STATUS & SPIF) == 0)
; /* null statement */
return (HC11.SPSRDAT.STATDATA); /* return status and data */
} /* end of rdbytspi */